package 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	
	public class HarmonyCanvas extends Sprite
	{
		//--------------------------------------------------------------------------
		//
		//  Variables
		//
		//--------------------------------------------------------------------------
		private var background:Sprite;
		private var bitmap:Bitmap;
		public var drawing:Sprite;
		public var bmpCanvas:BitmapData;
		//--------------------------------------------------------------------------
		//
		//  Initialization
		//
		//--------------------------------------------------------------------------
		public function HarmonyCanvas(newWidth:int, newHeight:int)
		{
			super();
						
			// create Bitmap for storing the drawing
			this.bmpCanvas = new BitmapData(newWidth,newHeight,false,0xFFEEEEEE);
			this.bitmap = new Bitmap(this.bmpCanvas,"auto",true);
			this.bitmap.x = 0;
			this.bitmap.y = 0;
			addChild(this.bitmap);
			
			//canvas for frame drawing
			this.drawing = new Sprite();
			this.drawing.x = bitmap.x;
			this.drawing.y = bitmap.y;
			
			// background of the canvas and important for getting MouseEvent data
			background = new Sprite();
			background.x = 0;
			background.y = 0;
			background.graphics.beginFill(0xEEEEEE);
			background.graphics.drawRect(0,0,newWidth,newHeight);
			background.graphics.endFill();
			addChild(background);
			
			// Set up the canvas
			this.bmpCanvas.draw(this.drawing);
			addChild(this.drawing);
			swapChildren(background,bitmap);
			
		}
		//--------------------------------------------------------------------------
		//
		//  Properties
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  Additional getters and setter
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  API
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  Eventhandling
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  Broadcasting
		//
		//--------------------------------------------------------------------------
	}
}